package prototype;

import framework.Product;

public class MessageBox implements Product {

    private char decochar;

    public MessageBox(char decochar) {
        this.decochar = decochar;
    }

    public void use(String s) {
        System.out.println(getLine(s));
        System.out.println(decochar + " " + s + " " +decochar);
        System.out.println(getLine(s));
    }

    public Product createClone() {
        Product p = null;
        try {
            p = (Product) clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return p;
    }

    private String getLine(String s){
        StringBuilder result = new StringBuilder();

        for(int i = 0; i < s.length(); i++){
            result.append(decochar);
        }

        return result.toString();
    }
}
